package runTest;

import constants.UserInfoConstant;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import utils.WebDriverUtils;

public class Demo extends WebDriverUtils {
    public Demo(String url) {
        super(url);
    }


    public static void main(String[] args) {
        Demo demo = new Demo(WebDriverUtils.INIT_URL);
        WebDriver driver = demo.driver;
        driver.get("http://localhost:5173/user/login");
        driver.findElement(By.cssSelector("#van-field-1-input")).sendKeys(UserInfoConstant.USER_ACCOUNT);
        driver.findElement(By.cssSelector("#van-field-2-input")).sendKeys(UserInfoConstant.USER_PASSWORD);
        WebElement loginButton = driver.findElement(By.cssSelector("#login > form > div:nth-child(2) > button.van-button.van-button--primary.van-button--normal.van-button--block.van-button--round"));
        Actions actions = new Actions(driver);
        // 使用动作链点击元素
        actions.moveToElement(loginButton).click().perform();
        driver.get("http://localhost:5173/team");
    }
}
